//
//  ImageWithLabel.m
//  BeautyClother
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "ImageWithLabel.h"

@interface ImageWithLabel ()

@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation ImageWithLabel


- (void)dealloc
{
    [_title release];
    [_ima release];
    [super dealloc];
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
              

        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        [self createButton];
    }
    return self;
}

- (void)createButton
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    
    button.frame = CGRectMake(0, 0, 80 * _offWidth, 90 *_offHeight);
    [self addSubview:button];

    _title = [[UILabel alloc]initWithFrame:CGRectMake(0, 70 * _offHeight, button.frame.size.width, 20* _offHeight)];
    [button addSubview:_title];
    _title.userInteractionEnabled = YES;
    
    
    _title.font = [UIFont systemFontOfSize:15];
    _title.textColor = [UIColor darkGrayColor];
    _title.textAlignment = 1;
    
    _ima = [[UIImageView alloc]initWithFrame:CGRectMake(15 * _offWidth, 10 * _offHeight, 50 *_offWidth, 50 * _offHeight)];
    [button addSubview:_ima];
    _ima.layer.cornerRadius = 50 *_offWidth / 2 ;
    _ima.layer.masksToBounds = YES;
    _ima.userInteractionEnabled = YES;
    

}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
